package com.admin.service.impl;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.admin.mapper.BaseMapper;
import com.admin.service.BaseService;

@Component
public abstract class BaseServiceImpl<T> implements BaseService<T> {

    @Autowired
    private BaseMapper<T> baseMapper;

    public BaseMapper<T> getBaseMapper() {
        return baseMapper;
    }

    public void setBaseMapper(BaseMapper<T> baseMapper) {
        this.baseMapper = baseMapper;
    }

    @Override
    public T selectByPrimaryKey(Serializable s) {
        return baseMapper.selectByPrimaryKey(s);
    }

    @Override
    public Integer insertSelective(T t) {
        return baseMapper.insertSelective(t);
    }

    @Override
    public Integer insert(T t) {
        return baseMapper.insert(t);
    }

    @Override
    public Integer deleteByPrimaryKey(Serializable s) {
        return baseMapper.deleteByPrimaryKey(s);
    }

    @Override
    public Integer updateSelective(T t) {
        return baseMapper.updateByPrimaryKeySelective(t);
    }

    @Override
    public Integer update(T t) {
        return baseMapper.updateByPrimaryKey(t);
    }

    @Override
    public List<T> selectList(Map<String, Object> params) {
        return baseMapper.selectByMap(params);
    }
}
